<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@include file="/include/include.jsp"%>
<%@page contentType= "text/html;charset=UTF-8" %>

<head>
	<link rel="stylesheet" type="text/css" href="<wst:webRoot/>/home/assets/home.css"/>
</head>
<body  class="yui3-skin-sam">
<div id="wallpaper">
<div id="desktop" class="yui3-g" style="overflowst:hidden;">
	<div id="iconsPanel" class="yui3-u-1-12">
	</div>

	<div id="icon-panel" class="yui3-u-11-12">
		<ul class="desk-icons">
			<li id='doubanfm' class="desk-icon" dlgUrl='http://douban.fm/partner/qq_plus' dlgHeight='464' dlgWidth='550' dlgTitle='豆瓣音乐'>
				<span class="icon-img">
					<img src="<wst:webRoot/>/home/assets/icons/doubanfm.png" />
				</span>
				<span class="icon-text">豆瓣音乐<s></s></span>
			</li>
			
			<li id='patch' class="desk-icon" dlgUrl='<wst:webRoot/>/patch/PatchController/list.do' dlgHeight='464' dlgWidth='550' dlgTitle='系统升级'>
				<span class="icon-img">
					<img src="<wst:webRoot/>/home/assets/icons/patch.png" />
				</span>
				<span class="icon-text">系统升级<s></s></span>
			</li>
		
			<li id='add' class="desk-icon">
				<span class="icon-img">
					<img src="<wst:webRoot/>/home/assets/icons/add.png" />
				</span>
				<span class="icon-text">添加<s></s></span>
			</li>
		</ul>
	</div>
</div>
</div>
<div id='desktopWindows' style='width:0px;height:0px'></div>
<script>
YUI().use('node', 'event','panel','dd-plugin','align', function (Y) {
	
	var winSerialNumber = 0;
	
	function openWindow(event){
		var iconId = this.get('id');
		winSerialNumber++;
		var dialogId = iconId+'Dialog'+ winSerialNumber;
		var windowId = iconId+'Window'+ winSerialNumber;
		
		var desktopWindows = Y.one('#desktopWindows');
		desktopWindows.append('<div id="'+dialogId+'"><iframe id="'+windowId+'"frameborder="no" border="0" src=""></iframe></div>');
		
		var newWindow = desktopWindows.one('#'+windowId);
		var newDialog = desktopWindows.one('#'+dialogId);
		
		newWindow.setAttribute('src',this.getAttribute('dlgUrl'));
		newWindow.setAttribute('width',this.getAttribute('dlgWidth'));
		newWindow.setAttribute('height',this.getAttribute('dlgHeight'));
		 
		var panel = new Y.Panel({
		        srcNode	: newDialog,
		        headerContent: this.getAttribute('dlgTitle'),
		        centered: true,
		        buttons:[{
				    section: 'header',
				    template  : '<button type="button" />',
            		classNames: Y.ClassNameManager.getClassName('button', 'close'),
            		action:function(){
            				panel.destroy(false);
            			}
		        	}
		        ]
	    });
		panel.plug(Y.Plugin.Drag);
		panel.render(); 
	}
	Y.delegate('click',openWindow,'#icon-panel','.desk-icon');
	
	 
});
</script>
</body>
</html>